/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LXW
 * Date: 2022-04-07
 * Time: 18:04
 */
public class Demo3 {
    public static void main(String[] args) {
        class MyThread extends Thread {
            @Override
            public void run() {
                for (int i = 0; i < 10; i++) {
                    System.out.println(Thread.currentThread().getName()+"我还在工作");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                System.out.println(Thread.currentThread().getName()+"我结束了");
            }
        }
        Thread t1 = new MyThread();
        Thread t2 = new MyThread();
        System.out.println("先让李四开始工作");
        t2.start();
        //t2.join();
        System.out.println("李四工作结束了");
        System.out.println("王五开始工作");
        t1.start();
        //t1.join();
        System.out.println("王五工作结束了");
    }
}
